home *** CD-ROM | disk | FTP | other *** search
/ Champak 43 / Vol 43.iso / games / phit.swf / scripts / __Packages / FreshDebug.as < prev    next >
Encoding:
Text File  |  2007-07-13  |  1.4 KB  |  64 lines

  1. class FreshDebug
  2. {
  3.    function FreshDebug()
  4.    {
  5.    }
  6.    static function Assert(expression, stringForm)
  7.    {
  8.       if(_global._dbgAssertEnabled && !expression)
  9.       {
  10.          var _loc2_ = "FRESH ASSERT: Expression \'" + stringForm + "\'";
  11.          throw _loc2_;
  12.       }
  13.       return expression;
  14.    }
  15.    static function Trace(msg, tag)
  16.    {
  17.       if(_global._dbgTraceEnabled)
  18.       {
  19.          if(!FreshDebug.IsSuppressed(tag))
  20.          {
  21.             if(_root._debugWindow)
  22.             {
  23.                CDebugWindow(_root._debugWindow).Trace(msg);
  24.             }
  25.          }
  26.       }
  27.    }
  28.    static function Suppress(tag)
  29.    {
  30.       if(tag == undefined || tag.length == 0)
  31.       {
  32.          tag = "<undefined>";
  33.       }
  34.       if(!_global._mapSuppressedTags)
  35.       {
  36.          _global._mapSuppressedTags = new Array();
  37.       }
  38.       _global._mapSuppressedTags[tag] = true;
  39.    }
  40.    static function Unsuppress(tag)
  41.    {
  42.       if(tag == undefined || tag.length == 0)
  43.       {
  44.          tag = "<undefined>";
  45.       }
  46.       if(_global._mapSuppressedTags)
  47.       {
  48.          _global._mapSuppressedTags[tag] = undefined;
  49.       }
  50.    }
  51.    static function IsSuppressed(tag)
  52.    {
  53.       if(tag == undefined || tag.length == 0)
  54.       {
  55.          tag = "<undefined>";
  56.       }
  57.       if(!_global._mapSuppressedTags)
  58.       {
  59.          return false;
  60.       }
  61.       return _global._mapSuppressedTags[tag];
  62.    }
  63. }
  64.